Downloading bird presence absence using R Atlas

Functions description

Bird presence / absence are generated through observations datasets that are qualified as exhaustive, meaning datasets from which we can deduce an absence for a species at a specific date - time - location combination (defined as sampling points).

Two distinct functionalites are available in ratlas for that purpose.

  • list_bird_quebec_taxa_ref() returns a dataframe containining all taxons observed within quebec`s territory, for any rank, taxon reference source or validity of taxons. The returned objects provide also general statistics on occurrence of species.

  • get_bird_presence_absence(taxa_name) returns a dataframe of the same amount of sampling points, for which the attribute occurrence is TRUE if the taxon has been observed at the sampling points, or FALSE otherwise. Other attributes related to position, date, time, taxon and observation datasets are included.

The equivalent functions for Montreal’s territory are respectively list_bird_mtl_taxa_ref() and get_mtl_bird_presence_absence(taxa_name) with the same usage.

Usage

Remarks about libraries In the folloiwing examples, Data.frame manipulation is done through dplyr, geographic type handling is done through sf and the display of geographic data is done with leaflet.

library(ratlas)
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(sf)
#> Linking to GEOS 3.9.1, GDAL 3.2.1, PROJ 7.2.1
library(leaflet)
library(knitr)

List observed bird taxons

A single call will list all observed taxons within quebec’s territory. However, additionnal parameters may be added to filter taxa records through their rank and their validity.

Example : List only valid species

species <- list_bird_taxa(rank = 'species', valid = TRUE)
head(species) %>% kable()
id source_name source_id source_record_id scientific_name authorship rank valid valid_srid classification_srids created_at modified_at modified_by max_yearly_count avg_yearly_count min_yearly_count total_count min_year_obs max_year_obs
153032 Catalogue of Life 1 7TCSX Dryobates pubescens Linnaeus, 1766 species TRUE 7TCSX 5T6MX, N , CH2 , V2 , 3TR , 625L8, K5T , 7NXMX, 7TCSX 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 37336 3266.6818 1 215601 1950 2019
153046 ITIS 3 1145276 Dryobates pubescens Linnaeus, 1766 species TRUE 1145276 202423 , 914154 , 914156 , 158852 , 331030 , 914179 , 914181 , 174371 , 178140 , 178148 , 553479 , 1145208, 1145276 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 37336 3266.6818 1 215601 1950 2019
153048 GBIF Backbone Taxonomy 11 9149595 Dryobates pubescens Dryobates pubescens species TRUE 9149595 1 , 44 , 212 , 724 , 9333 , 8399994, 9149595 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 37336 3266.6818 1 215601 1950 2019
153063 Catalogue of Life 1 3T2QB Leiothlypis peregrina A. Wilson, 1811 species TRUE 3T2QB 5T6MX, N , CH2 , V2 , 3RL , 626BR, 5BZB , 3T2QB 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 5620 506.7937 1 31928 1950 2019
153076 ITIS 3 950014 Leiothlypis peregrina A. Wilson, 1811 species TRUE 950014 202423, 914154, 914156, 158852, 331030, 914179, 914181, 174371, 178265, 178842, 950007, 950014 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 5620 506.7937 1 31928 1950 2019
153078 GBIF Backbone Taxonomy 11 7415507 Leiothlypis peregrina Leiothlypis peregrina species TRUE 7415507 1 , 44 , 212 , 729 , 5263 , 7467942, 7415507 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 5620 506.7937 1 31928 1950 2019

There are multiple valid record for a single species since we are returning a record for each taxonomic reference backbone, since some of them might disagree on validity of taxon for a single organism. A unique list of organism name may be generated from the taxonomic source_name or using distinct scientific_name.

# Unique organism using gbif taxonomic backbone
species %>% dplyr::filter("source_name" == "GBIF Backbone Taxonomy")
#> # A tibble: 0 x 19
#> # ... with 19 variables: id <int>, source_name <chr>, source_id <int>,
#> #   source_record_id <chr>, scientific_name <chr>, authorship <chr>,
#> #   rank <chr>, valid <lgl>, valid_srid <chr>, classification_srids <list>,
#> #   created_at <chr>, modified_at <chr>, modified_by <chr>,
#> #   max_yearly_count <int>, avg_yearly_count <dbl>, min_yearly_count <int>,
#> #   total_count <int>, min_year_obs <int>, max_year_obs <int>

# Unique organism using distinct `scientific_name`
species <- species %>% dplyr::distinct(scientific_name, .keep_all = TRUE)

A general understanding of the frequency and characteristics of occurrences may be understood through the values of max_yearly_count, avg_yearly_count, min_yearly_count, total_count, min_year_obs and max_year_obs. We thus can order the species by the total_count of occurrences in descending order and inspect the 10 most observed species.

species %>% arrange(-total_count) %>% head(10) %>% kable()
id source_name source_id source_record_id scientific_name authorship rank valid valid_srid classification_srids created_at modified_at modified_by max_yearly_count avg_yearly_count min_yearly_count total_count min_year_obs max_year_obs
155214 Catalogue of Life 1 YNHD Corvus brachyrhynchos C. L. Brehm, 1822 species TRUE YNHD 5T6MX, N , CH2 , V2 , 3RL , 8L6 , 62LZ4, YNHD 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 73689 6519.565 1 449850 1950 2019
154936 Catalogue of Life 1 4KSBV Poecile atricapillus Linnaeus, 1766 species TRUE 4KSBV 5T6MX, N , CH2 , V2 , 3RL , 626B2, 6TGS , 4KSBV 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 72193 5996.257 1 419738 1950 2019
154633 Catalogue of Life 1 59PMB Turdus migratorius Linnaeus, 1766 species TRUE 59PMB 5T6MX, N , CH2 , V2 , 3RL , HLW , 647VS, 59PMB 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 52100 4578.188 1 315895 1950 2019
155129 Catalogue of Life 1 4Z662 Spinus tristis Linnaeus, 1758 species TRUE 4Z662 5T6MX, N , CH2 , V2 , 3RL , 6244D, 7L9G , 4Z662 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 53827 4535.273 1 299328 1950 2019
154249 Catalogue of Life 1 3ZN55 Melospiza melodia A. Wilson, 1810 species TRUE 3ZN55 5T6MX, N , CH2 , V2 , 3RL , 9N5 , 62YTB, 3ZN55 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 55540 4137.129 1 289599 1950 2019
155598 Catalogue of Life 1 3SBQ4 Larus delawarensis Ord, 1815 species TRUE 3SBQ4 5T6MX, N , CH2 , V2 , X3 , BSK , 62XFH, 3SBQ4 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 42448 4176.203 1 267277 1950 2019
157296 Catalogue of Life 1 DGP6 Anas platyrhynchos Linnaeus, 1758 species TRUE DGP6 5T6MX, N , CH2 , V2 , PQ , 6D5 , J59 , V8R , DGP6 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 41167 4203.344 1 256404 1955 2019
154384 Catalogue of Life 1 32NKH Cyanocitta cristata Linnaeus, 1758 species TRUE 32NKH 5T6MX, N , CH2 , V2 , 3RL , 8L6 , 3XNL , 32NKH 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 45341 3767.662 1 256201 1950 2019
154550 Catalogue of Life 1 5384V Sturnus vulgaris Linnaeus, 1758 species TRUE 5384V 5T6MX, N , CH2 , V2 , 3RL , GRP , 7PLY , 5384V 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 34754 3635.632 1 247223 1950 2019
153032 Catalogue of Life 1 7TCSX Dryobates pubescens Linnaeus, 1766 species TRUE 7TCSX 5T6MX, N , CH2 , V2 , 3TR , 625L8, K5T , 7NXMX, 7TCSX 2021-11-23T11:27:50.388395-05:00 2021-11-23T11:27:50.388395-05:00 postgres 37336 3266.682 1 215601 1950 2019

Get presence/absence data

We can obtain a data.frame containing the presence and absence of a taxon using the function get_mtl_bird_presence_absence(). The function downloads and returns a dataframe containing presence and absence (values TRUE or FALSE) with a single record per row for the bird species specified by taxa_name.

The absence are infered from all sampling points related to birds observed on Montreal territory whose observations were obtained from datasets defined as exhaustive, from the eBird and Atlas des oiseaux nicheurs du Quebec datasets.

occurences <- get_bird_presence_absence(
  taxa_name = "Picoides villosus",
  .cores = 8)
head(occurences) %>% kable()
geom year_obs month_obs day_obs time_obs dataset_id dataset_name taxa_ref_id taxa_scientific_name occurrence
SRID=4326;POINT(-70.4167 81.8333) 1995 7 27 10:00:00 NA NA NA NA FALSE
SRID=4326;POINT(-71 81.8167) 2013 6 11 NA NA NA NA NA FALSE
SRID=4326;POINT(-71 81.8167) 2013 6 12 NA NA NA NA NA FALSE
SRID=4326;POINT(-71 81.8167) 2013 6 13 NA NA NA NA NA FALSE
SRID=4326;POINT(-71 81.8167) 2013 6 14 NA NA NA NA NA FALSE
SRID=4326;POINT(-71 81.8167) 2013 6 16 NA NA NA NA NA FALSE

The geom attributes provide a Well Known Text (WKT) of the position of occurrence and may by put into a sf simple feature data.frame for manipulation and easy mapping. Here, we filter only presence where occurrence is TRUE since year 2015 and plot them on a map.

occurrences <- st_as_sf(occurences, wkt = "geom")
map <- leaflet() %>%
  addTiles() %>%
  addMarkers(data = filter(occurrences, occurrence == TRUE, year_obs >= 2015),
    clusterOptions = markerClusterOptions())
map